<?php

class Pablo
{
	private function __construct()
	{
		$this->_setupRegistration();
	}
	
	/*
		Registered settings
	*/
	private $types;
	
	private function _setupRegistration()
	{
		$this->types['particle'] = new Type(array(
			'id' => 'Particle',
			'description' => '',
			//'abstract' => true,
			'datafields' => array(
			)
		));
	}
	
	public function getType($id)
	{
		if (!isset($this->types[$id]))
		{
			die('Error 4');
		}
		
		return $this->types[$id];
	}
	
	public function registerType($Type)
	{
		if (isset($this->types[(string)$Type]))
		{
			die('Error 2');
		}
		
		$this->types[(string)$Type] = $Type;
	}
	
	/*
		Singleton pattern
	*/
	static private $instance;
	
	public function getSingletonInstance()
	{
		if (!isset(self::$instance))
		{
			self::$instance = new Pablo();
		}
		
		return self::$instance;
	}
	
	public function __clone()
	{
		die('Error 1');
	}
}

?>